import request from '@/router/axios';
import {
  // projectApi,
  // fileApi,
  systemApi,
  userApi
} from '@/api/apiPrefix/apiPrefix'



export const getList = (current, size, params, deptId) => {
  return request({
    url: systemApi + 'role/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
      deptId,
    }
  })
}

export const deptList = (current, size, params) => {
  return request({
    url: systemApi + 'dept/lazy-list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}


//条件字典接口
export const getDictionary = (code) => {
  return request({
    url: systemApi + 'dict-biz/dictionary',
    method: 'get',
    params: {
      code
    }
  })
}

//流程实例列表
export const getFlowList = (current, size, params) => {
  return request({
    url: systemApi + 'flow/info/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}


// 流程实例的保存接口
export const submitFlow = (data) => {
  return request({
    // meta: {
    //     isSerialize: true
    // },
    url: systemApi + 'flow/info/submit',
    method: 'post',
    data: data
  })
}

// 流程实例的修改接口
export const updateFlow = (data) => {
  return request({
    // meta: {
    //     isSerialize: true
    // },
    url: systemApi + 'flow/info/submit',
    method: 'post',
    data: data
  })
}

// 流程实例的删除接口
export const delFlow = (ids) => {
  return request({
    url: systemApi + 'flow/info/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

// 流程模型的删除接口
export const delModel = (ids) => {
    return request({
        url: systemApi + 'flow/model/remove',
        method: 'post',
        params: {
            ids,
        }
    })
}

// 业务审批列表
export const getWorkList = (current, size, bussinessId, params) => {
  return request({
    url: systemApi + 'flow/log/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
      bussinessId,

    }
  })
}

// 获得下一节点审批人
export const getNextNodePerson = (params) => {
    return request({
        url: systemApi + 'flow/flow/nextPersonList',
        method: 'post',
        params: {
            ...params,
        }
    })
}

// 流程模型修改
export const flowSubmit = (id) => {
  return request({    // meta: {
    // isSerialize: true
    // },
    url: systemApi + 'flow/model/detail',
    method: 'get',
    params: {
      id
    }
  })
}


// 流程模型保存
export const modelSubmit = (data) => {
    return request({
      url: systemApi + 'flow/model/submit',
      method: 'post',
     data
    })
  }
  //流程实例列表
export const getmodelList = (params) => {
  return request({
    url: systemApi + 'flow/model/list',
    method: 'get',
    params: {
      ...params,
    }
  })
}

export const memberList = (current, size, params, deptId) => {
    return request({
        url: userApi + 'page',
        method: 'get',
        params: {
            ...params,
            current,
            size,
            deptId,
        }
    })
}


// 流程模型激活
export const flowModelActive = (id,status) => {
    return request({
        url: systemApi + 'flow/model/active',
        method: 'post',
        params: {
           id:id,
           status:status
        }
    })
}

